package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Volumelibrary {
    private long vlno;
    private String vlid;
    private String vlname;
    private Dept dept;
    private List<Dossier> dossiers;

    @Id
    @Column(name = "VLNO")
    public long getVlno() {
        return vlno;
    }

    public void setVlno(long vlno) {
        this.vlno = vlno;
    }

    @Basic
    @Column(name = "VLID")
    public String getVlid() {
        return vlid;
    }

    public void setVlid(String vlid) {
        this.vlid = vlid;
    }

    @Basic
    @Column(name = "VLNAME")
    public String getVlname() {
        return vlname;
    }

    public void setVlname(String vlname) {
        this.vlname = vlname;
    }


    @ManyToOne
    @JoinColumn(name="DEPT_NO")
    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }

    @OneToMany(mappedBy="volumelibrary")
    public List<Dossier> getDossiers() {
        return dossiers;
    }

    public void setDossiers(List<Dossier> dossiers) {
        this.dossiers = dossiers;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Volumelibrary that = (Volumelibrary) o;
        return vlno == that.vlno &&
                Objects.equals(vlid, that.vlid) &&
                Objects.equals(vlname, that.vlname);
    }

    @Override
    public int hashCode() {
        return Objects.hash(vlno, vlid, vlname);
    }
}
